package com.xp.kettlegenerate.start;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import org.pentaho.reporting.engine.classic.core.wizard.AutoGeneratorUtility;

import java.nio.file.Paths;

public class MybatisPlusGenerate {

    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:sqlite:D:\\Idea_workSpace\\kettle-demo\\kettle-generate\\src\\main\\resources\\sqlite\\kettle_generate.db",
                        "", "")
                .globalConfig(builder -> builder
                        .author("xxx")
                        .outputDir(Paths.get(System.getProperty("user.dir")) + "/src/main/java")
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("com.xp.kettlegenerate")
                        .entity("entity")
                        .mapper("mapper")
                        .service("service")
                        .serviceImpl("service.impl")
                        .xml("mapper.xml")
                )
                .strategyConfig(builder -> builder
                        .addInclude("GENERATE_TABLE","DATA_BASE_META")
                        .entityBuilder()
                        .enableLombok()
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}
